/*
 * Copyright 2021 ThoughtWorks, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
@import "../../global/common";

$spinner-wrapper-height: 200px;
$current-user-tag-bg-color: #eee;
$disabled-text-color: #999;
$max-user-tag-width: 200px;
$warning-wrapper-width: 170px;

.spinner-wrapper {
  min-height: $spinner-wrapper-height;
}

.tag {
  margin-right:    5px;
  padding:         2px 10px;
  display:         inline-flex;
  font-size:       13px;
  color:           $text-color;
  font-weight:     600;
  border-radius:   2px;
  border:          1px solid $border-color;
  margin-bottom:   10px;
  justify-content: space-between;

  span {
    max-width:     $max-user-tag-width;
    overflow:      hidden;
    text-overflow: ellipsis;
    white-space:   nowrap;
  }
}

.current-user-tag {
  animation-name:     color-effect;
  animation-duration: 4s;
  background-color:   $current-user-tag-bg-color;
  color:              $text-color;
}

.role-user-delete-icon {
  float:       right;
  margin-left: 10px;
  cursor:      pointer;
  font-size:   20px;
  line-height: 1;
}

.role-user-delete-icon:hover {
  color: $link-hover-color;
}


label.disabled, input[type='radio'][disabled] + label[for] { //sass-lint:disable-line no-qualifying-elements
  color:  $disabled-text-color;
  cursor: not-allowed;

  i, p {
    color: $black;
  }
}

.add-user-to-role {
  display:    flex;
  align-self: center;

  button {
    display: inline;
    margin:  0 0 0.8rem;
  }
}

.users-in-role {
  display: block;
  width:   100%;
  padding: 0 15px;
}

.no-users-message {
  font-size: 13px;
  color:     $disabled-text-color;
}

.warning-wrapper {
  &:hover {
    .warning-content {
      display: block;
    }
  }
}

.warning-content {
  display:        none;
  background:     $white;
  line-height:    18px;
  font-size:      12px;
  position:       absolute;
  margin-left:    72px;
  font-weight:    400;
  border-radius:  $global-border-radius;
  padding:        10px;
  box-shadow:     0 2px 4px $box-shadow-color;
  text-transform: none;
  z-index:        map_get($zindex, tooltip);
  width:          $warning-wrapper-width;

  &:before {
    content:          "";
    position:         absolute;
    width:            0;
    height:           0;
    margin-left:      -0.5em;
    top:              0;
    left:             17px;
    box-sizing:       border-box;
    border:           6px solid $black;
    border-color:     $white $white transparent transparent;
    transform-origin: 0 0;
    transform:        rotate(-45deg);
    box-shadow:       1px -1px 1px 0 $box-shadow-color;
  }
}

.info-icon {
  @include icon-before($type: $fa-var-info-circle, $color: $black);

  &:before {
    font-size: 15px;
    padding:   2px;
  }
}

.icon-delete {
  @include icon-before($type: $fa-var-times);
  border:  none;
  display: inline;
  cursor:  pointer;
  width:   22px;
  height:  22px;
  padding: 0;

  &:before {
    margin: 0;
  }

  &:focus {
    outline: none;
  }
}

.add-permission {
  margin-top: 20px;
}

.select-permission {
  input, select {
    width:  200px;
    margin: 0 0;
  }

  td > div {
    margin-bottom: 0;
  }

  td {
    &:nth-child(5) {
      input {
        margin: 0;
      }
    }
  }
}

.tips {
  background: $white;
  padding:    20px;
}
